import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
// import home from '@/components/home/home.vue'
// import City from '@/components/city/city.vue'
// import Detail from '@/components/detail/Detail'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      // 下面是异步加载，当进入页面的时候再加载，适合与比较大的项目
      component: () => import('@/components/home/home.vue')
    },
    {
      path: '/city',
      name: 'city',
      component: () => import('@/components/city/city.vue')
    },
    {
      path: '/detail/:id',
      name: 'detail',
      component: () => import('@/components/detail/Detail.vue')
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})
